#include <algorithm>
#include <cstdint>
#include <iostream>
#include <istream>
#include <limits>
#include <ostream>
#include <vector>

using ll = int64_t;

ll n,w,b,x;
std::vector<ll> c,cost;
constexpr ll inf = std::numeric_limits<ll>::min();

static inline ll dp(ll i,ll j){
    if(i==0){
        if(j==0)return w;
        else return inf;
    }
    static std::vector<std::vector<ll>> vdp(n+1,std::vector<ll>(10000+1,inf));
    if(vdp[i][j]!=inf)return vdp[i][j];
    for(ll k=0;k<=c[i];k++){
        if(j-k<0||dp(i-1,j-k)<0)continue;
        vdp[i][j]=std::max(vdp[i][j],std::min(dp(i-1, j-k)+x,w+(j-k)*b)-cost[i]*k);
    }
    return vdp[i][j];
}

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cin>>n>>w>>b>>x;
    c.resize(n+1);
    cost.resize(n+1);
    for(ll i=1;i<=n;i++){
        std::cin>>c[i];
    }
    for(ll i=1;i<=n;i++){
        std::cin>>cost[i];
    }
    for(ll i=1000;i>=0;i--){
        if(dp(n, i)>=0){
            std::cout<<i<<std::endl;
            _Exit(0);
        }
    }
    throw;
}